package java04;
//所以有员工的父类
public class Employee {
    private String name;//员工姓名
    private int month;//员工生日月份

    public Employee() {
    }

    public Employee(String name, int month) {
        this.name = name;
        this.month = month;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public int getMonth() {
        return month;
    }

    public void setMonth(int month) {
        this.month = month;
    }
    //过生日额外工资
    public double getSalary(int month){
        if(getMonth() == month){
            return 100;
        }
        return 0;
    }
}
//子类员工SalariedEmployee继承父类Employee
class SalariedEmployee extends Employee{
    //工资
    private double money;

    public SalariedEmployee() {
    }

    public SalariedEmployee(String name, int month, int money) {
        super(name, month);
        this.money = money;
    }

    public double getMoney() {
        return money;
    }

    public void setMoney(double money) {
        this.money = money;
    }
    //某月工资
    public double getSalary(int month){
        if(this.getMonth() == month){
            return 100 + money;
        }
        return money;
    }
}
//员工类HourlyEmployee继承父类员工Employee
class HourlyEmployee extends Employee{
    private double hmoney;//每小时的工资
    private int hour;//工时

    public HourlyEmployee() {
    }

    public HourlyEmployee(String name, int month, double hmoney, int hour) {
        super(name, month);
        this.hmoney = hmoney;
        this.hour = hour;
    }

    public double getHmoney() {
        return hmoney;
    }

    public void setHmoney(double hmoney) {
        this.hmoney = hmoney;
    }

    public int getHour() {
        return hour;
    }

    public void setHour(int hour) {
        this.hour = hour;
    }
    //工资
    public double monthMoney(){
        if(hour > 160){
            return hmoney * 160 + (this.hour - 160) * 1.5;
        }
        return hmoney * hour;
    }//某月工资
    public double getSalary(int month){
        if(getMonth() == month){
            return 100 + this.monthMoney();
        }
        return this.monthMoney();
    }
}
//员工类SalesEmployee继承父类员工Employee
class SalesEmployee extends Employee{
    private int sale;//月销售额
    private double sales;//提成率

    public SalesEmployee() {
    }

    public SalesEmployee(String name, int month, int sale, double sales) {
        super(name, month);
        this.sale = sale;
        this.sales = sales;
    }

    public int getSale() {
        return sale;
    }

    public void setSale(int sale) {
        this.sale = sale;
    }

    public double getSales() {
        return sales;
    }

    public void setSales(double sales) {
        this.sales = sales;
    }
    //某月工资
    public double getSalary(int month){
        if(getMonth() == month){
            return 100 + (sale + sale * sales);
        }
        return sale + sale * sales;
    }
}
//员工类BasePlusSalesEmployee继承父类员工SalesEmployee
class BasePlusSalesEmployee extends SalesEmployee{
    private double basic;//底薪

    public BasePlusSalesEmployee() {
    }

    public BasePlusSalesEmployee(String name, int month, int sale, double sales, double basic) {
        super(name, month, sale, sales);
        this.basic = basic;
    }

    public double getBasic() {
        return basic;
    }

    public void setBasic(double basic) {
        this.basic = basic;
    }
    //某月工资
    public double getSalary(int month){
        if(getMonth() == month){
            return 100 + (basic + getSale() * getSales());
        }
        return (basic + getSale() * getSales());
    }
}
